import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class MyWidget(QMainWindow):

    def __init__(self):
        super().__init__()
        ##self.setGeometry(0, 0, 800, 600)
        self.initUi()

    def initUi(self):
        # base config
        self.resize(800, 600)
        self.setWindowTitle("PyQt Camera")

        #menu config
        menu_control = self.menuBar().addMenu("Control")
        act_quit = menu_control.addAction("quit")
        act_quit.triggered.connect(self.close)

        menu_help = self.menuBar().addMenu("Help")
        act_help = menu_help.addAction("About")
        act_help.triggered.connect(self.about)
        act_aboutqt = menu_help.addAction("About Qt")
        act_aboutqt.triggered.connect(self.aboutqt)

        # status config
        self.statusBar().showMessage("程序已就绪")
        self.show()

    def about(self):
        QMessageBox.about(self, "about this software", "wise system")

    def aboutqt(self):
        QMessageBox.aboutQt(self)

    def closeEvent(self, QCloseEvent):
        reply = QMessageBox.question(self, "信息", "你确定要退出吗?", QMessageBox.Yes, QMessageBox.No)
        if reply == QMessageBox.Yes:
            QCloseEvent.accept()
        else:
            QCloseEvent.ignore()


myapp = QApplication(sys.argv)
mywidget = MyWidget()
sys.exit(myapp.exec_())